package org.third.common.domain;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "suite_upgrades")
public class SuiteUpgrades {
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id") 
	private long id;
	
	@Column(name = "transaction_id", nullable = false, length = 50, unique = true)
	private String transactionId;
	
	@Column(name = "create_time")
	@Temporal(TemporalType.TIMESTAMP)
	private Date createTime;
	
	@Column(name = "upgrades_time")
	@Temporal(TemporalType.TIMESTAMP)
	private Date upgradesTime;
	
	@Column(name = "upgrades_version", nullable = false)
	private String upgradesVersion;
	
	@Column(name = "upgrades_order", nullable = false)
	private long upgradesOrder;
	
	@Column(name = "rollback_flag")
	private long rollbackFlag;
	
	@ManyToOne//(cascade=CascadeType.ALL) 
	@JoinColumn(name="deployment_id")
	private Deployment deployment;

	@OneToMany(cascade=CascadeType.ALL, mappedBy="suiteUpgrades")
	private Set<SuiteUpgradeImages> suiteUpgradeImages;
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getTransactionId() {
		return transactionId;
	}

	public void setTransactionId(String transactionId) {
		this.transactionId = transactionId;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}


	public Deployment getDeployment() {
		return deployment;
	}

	public void setDeployment(Deployment deployment) {
		this.deployment = deployment;
	}

	public Date getUpgradesTime() {
		return upgradesTime;
	}

	public void setUpgradesTime(Date upgradesTime) {
		this.upgradesTime = upgradesTime;
	}

	public String getUpgradesVersion() {
		return upgradesVersion;
	}

	public void setUpgradesVersion(String upgradesVersion) {
		this.upgradesVersion = upgradesVersion;
	}

	

	public long getRollbackFlag() {
		return rollbackFlag;
	}

	public void setRollbackFlag(long rollbackFlag) {
		this.rollbackFlag = rollbackFlag;
	}

	public Set<SuiteUpgradeImages> getSuiteUpgradeImages() {
		return suiteUpgradeImages;
	}

	public void setSuiteUpgradeImages(Set<SuiteUpgradeImages> suiteUpgradeImages) {
		this.suiteUpgradeImages = suiteUpgradeImages;
	}

	public long getUpgradesOrder() {
		return upgradesOrder;
	}

	public void setUpgradesOrder(long upgradesOrder) {
		this.upgradesOrder = upgradesOrder;
	}


}
